﻿<UserControl x:Class="Core.Views.Connection"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:helpers="clr-namespace:Helpers;assembly=Helpers"
             xmlns:controls="clr-namespace:Controls;assembly=Controls"
             d:DesignHeight="300"
             d:DesignWidth="300"
             mc:Ignorable="d">
    <UserControl.Resources>

        <Style x:Key="TextConnectStyle" TargetType="{x:Type TextBox}">
            <Setter Property="Foreground" Value="{StaticResource ColorEnteteAccueil}" />
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
            <Setter Property="BorderBrush" Value="{StaticResource ColorEnteteAccueil}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Padding" Value="2,3,0,0" />
            <Setter Property="AllowDrop" Value="true" />
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
            <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
            <Setter Property="Height" Value="28" />
            <Setter Property="Width" Value="250" />
        </Style>

        <Style x:Key="PasswordConnectStyle" TargetType="{x:Type PasswordBox}">

            <Setter Property="Foreground" Value="{StaticResource ColorEnteteAccueil}" />
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
            <Setter Property="BorderBrush" Value="{StaticResource ColorEnteteAccueil}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="AllowDrop" Value="true" />
            <Setter Property="Padding" Value="4,8,0,0" />
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
            <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
            <Setter Property="Height" Value="28" />
            <Setter Property="Width" Value="250" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type PasswordBox}">
                        <Grid>
                            <Border x:Name="Border"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" />
                            <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </UserControl.Resources>

    <Grid x:Name="Connect" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="200" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="550" />
        </Grid.ColumnDefinitions>

        <!--  Logo  -->
        <Image Grid.Row="0"
               Grid.Column="0"
               Width="354"
               Height="173"
               Margin="50,50,0,10"
               HorizontalAlignment="Left"
               Source="/Assets/Logo.png" />

        <!--  Zone d'authentification  -->
        <Grid Grid.Row="1" Grid.Column="0">

            <!--  Formulaire  -->
            <StackPanel Grid.Column="0"
                        Height="250"
                        Margin="100,0,0,0"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Orientation="Vertical">

                <StackPanel Orientation="Vertical">
                    <TextBlock Text="{helpers:Localize Connection_User}" />
                    <TextBox x:Name="user"
                             Style="{StaticResource TextConnectStyle}"
                             Text="{Binding User,
                                            Mode=TwoWay}"
                             controls:TextboxHelper.IsMonitoring="True"
                             controls:TextboxHelper.SelectAllOnFocus="True" />
                </StackPanel>

                <StackPanel Margin="0,20,0,0"
                            FocusManager.FocusedElement="{Binding ElementName=password}"
                            Orientation="Vertical">
                    <TextBlock Text="{helpers:Localize Connection_Password}" />
                    <PasswordBox x:Name="password"
                                 Style="{StaticResource PasswordConnectStyle}"
                                 controls:TextboxHelper.IsMonitoring="True"
                                 controls:TextboxHelper.SelectAllOnFocus="True"
                                 helpers:PasswordHelper.Attach="True"
                                 helpers:PasswordHelper.Password="{Binding Password,
                                                                           Mode=TwoWay}" />
                </StackPanel>

                <StackPanel Margin="0,20,0,0" Orientation="Horizontal">
                    <Button Width="110"
                            Command="{Binding CheckAuthentification}"
                            Content="{helpers:Localize Connection_Connect,
                                                   True}"
                            IsDefault="True"
                            Style="{DynamicResource MetroFlatButtonStevia}" />
                    <Button Width="110"
                            Margin="10,0,0,0"
                            Command="{Binding CloseApplicationCommand}"
                            Content="{helpers:Localize Generic_Annuler,
                                                   True}"
                            IsCancel="True"
                            Style="{DynamicResource MetroFlatButtonStevia}" />
                </StackPanel>

                <StackPanel Margin="0,10,0,0"
                            Orientation="Horizontal"
                            Visibility="{Binding MessageErreur,
                                                 Converter={StaticResource StringValueVisibilityConverter}}">
                    <Image Width="24"
                           Height="24"
                           VerticalAlignment="Center"
                           Source="/Assets/attention.png" />
                    <TextBlock MaxWidth="200"
                               Margin="10,0,0,0"
                               VerticalAlignment="Center"
                               Foreground="{DynamicResource ColorErrorBrush}"
                               Text="{Binding MessageErreur}"
                               TextWrapping="WrapWithOverflow" />
                </StackPanel>
            </StackPanel>
        </Grid>

        <!--  Explications  -->
        <StackPanel Grid.Row="0"
                    Grid.RowSpan="2"
                    Grid.Column="1"
                    Margin="10,0,0,0"
                    VerticalAlignment="Center"
                    Orientation="Horizontal">

            <Rectangle Width="1"
                       Margin="5,0,0,40"
                       VerticalAlignment="Stretch"
                       Fill="#FFeaeaea" />

            <StackPanel Margin="35,10,0,0" Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <Viewbox Width="58.625" Height="58.062">
                        <Canvas Width="58.625" Height="58.062">
                            <Canvas>
                                <Path Data="F1 M 57.625,57.062 L 1.000,57.062 L 1.000,1.000 L 57.625,1.000 L 57.625,57.062 Z"
                                      Stroke="{StaticResource ColorEnteteAccueil}"
                                      StrokeMiterLimit="1.0"
                                      StrokeThickness="2.0" />
                                <Rectangle Width="50"
                                           Height="50"
                                           Margin="4,4,4,4"
                                           Fill="{StaticResource ColorEnteteAccueil}" />
                                <Canvas>
                                    <Path Data="F1 M 13.457,22.116" Fill="{StaticResource ColorInvertAccueil}" />
                                    <Path Data="F1 M 21.002,29.347 C 16.068,29.365 11.720,37.642 11.736,42.709 C 11.736,42.709 37.279,42.724 45.313,42.709 C 45.319,38.008 41.167,29.374 35.765,29.397 L 21.002,29.347 Z" Fill="{StaticResource ColorInvertAccueil}" />
                                    <Path Data="F1 M 28.436,27.375 C 32.290,27.396 35.435,24.189 35.451,20.215 C 35.435,16.278 32.290,13.072 28.436,13.057 C 24.538,13.072 21.393,16.278 21.419,20.214 C 21.393,24.189 24.538,27.395 28.436,27.375 L 28.436,27.375 Z" Fill="{StaticResource ColorInvertAccueil}" />
                                    <Path Data="F1 M 28.610,20.214" Fill="{StaticResource ColorInvertAccueil}" />
                                </Canvas>
                            </Canvas>
                        </Canvas>
                    </Viewbox>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Margin="10,0,0,0"
                                   FontSize="16pt"
                                   Foreground="#FF979797"
                                   Text="{helpers:Localize Connection_ConnexionTo,
                                                       True}" />
                        <TextBlock Margin="10,2,0,0"
                                   FontSize="16pt"
                                   FontWeight="Bold"
                                   Foreground="{StaticResource ColorEnteteAccueil}"
                                   Text="{helpers:Localize MainCoreTitle,
                                                       True}" />
                    </StackPanel>
                </StackPanel>
                <TextBlock Width="300"
                           Margin="0,15,0,0"
                           FontSize="9pt"
                           Foreground="#FF979797"
                           Text="{helpers:Localize Connection_Explications}"
                           TextWrapping="Wrap" />

                <Viewbox Width="205.695"
                         Height="285.390"
                         Margin="0,80,0,0">
                    <Canvas Width="205.695" Height="285.390">
                        <Canvas>
                            <Path Data="F1 M 186.757,50.940 L 156.065,50.940 L 186.757,20.250 L 186.757,50.940 Z M 195.004,9.706 L 195.004,0.339 L 136.155,59.188 L 145.521,59.188 L 145.521,54.474 L 147.878,54.474 L 147.878,59.188 L 153.769,59.188 L 153.769,54.474 L 156.125,54.474 L 156.125,59.188 L 162.016,59.188 L 162.016,54.474 L 164.372,54.474 L 164.372,59.188 L 170.263,59.188 L 170.263,54.474 L 172.618,54.474 L 172.618,59.188 L 178.510,59.188 L 178.510,54.474 L 180.866,54.474 L 180.866,59.188 L 186.757,59.188 L 186.757,54.474 L 189.114,54.474 L 189.114,59.188 L 195.004,59.188 L 195.004,53.295 L 190.291,53.295 L 190.291,50.940 L 195.004,50.940 L 195.004,45.048 L 190.291,45.048 L 190.291,42.693 L 195.004,42.693 L 195.004,36.802 L 190.291,36.802 L 190.291,34.446 L 195.004,34.446 L 195.004,28.555 L 190.291,28.555 L 190.291,26.199 L 195.004,26.199 L 195.004,20.308 L 190.291,20.308 L 190.291,17.952 L 195.004,17.952 L 195.004,12.062 L 190.291,12.062 L 190.291,9.706 L 195.004,9.706 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                        </Canvas>
                        <Canvas>
                            <Path Data="F1 M 201.996,151.484 L 192.127,151.484 L 192.127,141.617 L 201.996,141.617 L 201.996,151.484 Z M 201.996,163.819 L 192.127,163.819 L 192.127,153.951 L 201.996,153.951 L 201.996,163.819 Z M 201.996,176.154 L 192.127,176.154 L 192.127,166.286 L 201.996,166.286 L 201.996,176.154 Z M 189.660,151.484 L 179.793,151.484 L 179.793,141.617 L 189.660,141.617 L 189.660,151.484 Z M 189.660,163.819 L 179.793,163.819 L 179.793,153.951 L 189.660,153.951 L 189.660,163.819 Z M 189.660,176.154 L 179.793,176.154 L 179.793,166.286 L 189.660,166.286 L 189.660,176.154 Z M 177.326,151.484 L 167.458,151.484 L 167.458,141.617 L 177.326,141.617 L 177.326,151.484 Z M 177.326,163.819 L 167.458,163.819 L 167.458,153.951 L 177.326,153.951 L 177.326,163.819 Z M 177.326,176.154 L 167.458,176.154 L 167.458,166.286 L 177.326,166.286 L 177.326,176.154 Z M 164.991,151.484 L 155.123,151.484 L 155.123,141.617 L 164.991,141.617 L 164.991,151.484 Z M 164.991,163.819 L 155.123,163.819 L 155.123,153.951 L 164.991,153.951 L 164.991,163.819 Z M 164.991,176.154 L 155.123,176.154 L 155.123,166.286 L 164.991,166.286 L 164.991,176.154 Z M 151.423,137.916 L 151.423,174.863 C 151.423,177.620 153.632,179.854 156.356,179.854 L 200.762,179.854 C 203.486,179.854 205.695,177.620 205.695,174.863 L 205.695,137.916 L 151.423,137.916 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 190.895,134.215 C 188.852,134.215 187.193,132.558 187.193,130.515 C 187.193,129.147 187.939,127.955 189.044,127.314 L 189.044,130.515 C 189.044,131.537 189.872,132.365 190.895,132.365 C 191.916,132.365 192.744,131.537 192.744,130.515 L 192.744,127.314 C 193.850,127.954 194.595,129.147 194.595,130.515 C 194.595,132.558 192.938,134.215 190.895,134.215 Z M 166.225,134.215 C 164.182,134.215 162.523,132.558 162.523,130.515 C 162.523,129.147 163.270,127.955 164.375,127.314 L 164.375,130.515 C 164.375,131.537 165.203,132.365 166.225,132.365 C 167.246,132.365 168.074,131.537 168.074,130.515 L 168.074,127.314 C 169.180,127.954 169.925,129.147 169.925,130.515 C 169.925,132.558 168.268,134.215 166.225,134.215 Z M 200.762,125.582 L 192.744,125.582 L 192.744,120.031 C 192.744,119.009 191.916,118.180 190.895,118.180 C 189.872,118.180 189.044,119.009 189.044,120.031 L 189.044,125.582 L 168.074,125.582 L 168.074,120.031 C 168.074,119.009 167.246,118.180 166.225,118.180 C 165.203,118.180 164.375,119.009 164.375,120.031 L 164.375,125.582 L 156.356,125.582 C 153.632,125.582 151.423,127.816 151.423,130.573 L 151.423,134.833 L 151.423,134.833 L 151.423,135.449 L 205.695,135.449 L 205.695,134.833 L 205.695,134.833 L 205.695,130.573 C 205.695,127.816 203.486,125.582 200.762,125.582 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                        </Canvas>
                        <Canvas>
                            <Path Data="F1 M 28.500,30.765 C 27.366,31.823 18.274,40.642 18.274,40.642 L 20.701,43.036 C 20.701,43.036 28.778,35.581 29.991,34.453 C 30.292,34.175 30.799,33.646 31.738,33.646 L 59.286,33.646 L 59.286,29.832 L 30.781,29.832 C 29.947,29.833 29.157,30.159 28.500,30.765 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 44.820,10.030 C 48.050,10.030 49.813,7.793 49.813,5.038 C 49.813,2.282 47.577,0.047 44.820,0.047 C 42.063,0.047 39.828,2.282 39.828,5.038 C 39.828,7.793 42.063,10.030 44.820,10.030 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 37.417,18.610 L 39.091,18.610 L 36.638,27.423 L 53.003,27.423 L 50.547,18.610 L 52.222,18.610 L 54.768,27.423 L 59.095,27.423 L 55.617,15.728 C 55.158,14.113 53.115,11.251 49.579,11.251 L 40.060,11.251 C 36.526,11.251 34.484,14.113 34.021,15.728 L 30.549,27.423 L 34.875,27.423 L 37.417,18.610 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 23.264,26.960 L 21.141,23.003 L 18.869,18.766 C 18.869,18.766 18.611,18.375 18.132,18.607 C 17.702,18.814 17.896,19.299 17.896,19.299 L 19.354,22.082 L 20.261,23.815 L 19.214,23.344 C 17.362,22.509 16.340,22.152 15.930,21.969 C 15.857,21.935 15.498,21.738 15.328,21.363 C 14.842,20.277 12.769,15.029 12.303,13.869 C 11.910,12.887 10.940,11.493 8.945,10.999 C 6.675,10.437 4.388,11.870 3.847,14.147 L 0.750,27.201 C 0.475,28.252 0.000,31.101 0.000,32.301 C 0.000,33.501 0.020,57.798 0.020,57.798 C 0.036,59.950 1.588,61.683 3.737,61.675 C 5.883,61.667 7.353,59.918 7.346,57.770 C 7.346,57.770 7.344,43.885 7.342,36.169 L 10.644,22.228 C 11.030,23.170 11.507,24.320 11.664,24.595 C 12.036,25.247 12.402,25.694 13.153,26.047 C 13.153,26.047 17.477,27.836 19.148,28.600 C 20.157,28.986 21.251,28.644 21.889,27.841 L 22.120,27.363 L 22.199,27.515 C 22.199,27.515 22.691,28.382 23.420,28.421 C 23.627,27.758 23.264,26.960 23.264,26.960 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 11.588,0.000 C 14.346,0.000 16.582,2.236 16.582,4.994 C 16.582,7.751 14.346,9.988 11.588,9.988 C 8.830,9.988 6.594,7.751 6.594,4.994 C 6.594,2.236 8.830,0.000 11.588,0.000 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 18.831,37.576 L 28.560,28.521 L 27.295,27.165 L 17.565,36.220 L 18.831,37.576 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                        </Canvas>
                        <Canvas>
                            <Canvas>
                                <Path Data="F1 M 40.862,275.221 L 33.581,275.221 L 33.581,277.058 L 40.862,277.058 L 40.862,275.221 Z M 30.496,275.221 L 23.215,275.221 L 23.215,277.058 L 30.496,277.058 L 30.496,275.221 Z M 19.869,254.885 L 43.879,254.885 L 43.879,239.600 L 19.869,239.600 L 19.869,254.885 Z M 47.027,282.964 L 44.536,270.301 L 19.148,270.301 L 17.246,282.964 L 47.027,282.964 Z M 16.852,257.181 C 16.852,255.672 15.541,254.360 13.965,254.360 C 12.456,254.360 11.144,255.672 11.144,257.181 C 11.144,258.755 12.456,260.001 13.965,260.001 C 15.541,260.002 16.852,258.755 16.852,257.181 Z M 56.541,254.098 L 56.541,273.319 C 56.541,275.551 54.705,277.388 52.604,277.388 L 48.603,277.388 L 50.374,285.390 L 14.097,285.390 L 15.541,277.388 L 11.210,277.388 C 8.848,277.388 7.143,275.551 7.143,273.319 L 7.143,254.098 C 7.143,251.868 8.848,250.031 11.210,250.031 L 16.261,250.031 L 16.261,243.865 L 18.032,243.865 L 18.032,237.107 L 45.716,237.107 L 45.716,243.865 L 47.486,243.865 L 47.486,250.031 L 52.604,250.031 C 54.705,250.031 56.541,251.868 56.541,254.098 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            </Canvas>
                            <Path Data="F1 M 78.657,28.814 L 121.328,28.814"
                                  Stroke="#ff969696"
                                  StrokeMiterLimit="1.0"
                                  StrokeThickness="2.0" />
                            <Path Data="F1 M 81.673,152.527 L 124.346,152.527"
                                  Stroke="#ff969696"
                                  StrokeMiterLimit="1.0"
                                  StrokeThickness="2.0" />
                            <Path Data="F1 M 30.646,187.192 L 30.646,229.864"
                                  Stroke="#ff969696"
                                  StrokeMiterLimit="1.0"
                                  StrokeThickness="2.0" />
                            <Path Data="F1 M 178.047,69.927 L 178.047,112.599"
                                  Stroke="#ff969696"
                                  StrokeMiterLimit="1.0"
                                  StrokeThickness="2.0" />
                        </Canvas>
                        <Canvas>
                            <Path Data="F1 M 35.830,147.633 L 25.571,140.542 L 46.090,140.542 L 35.830,147.633 Z M 0.546,134.548 L 0.546,140.542 L 15.027,140.542 L 35.830,154.920 L 52.801,143.190 L 52.801,162.154 L 18.529,162.154 L 18.529,168.147 L 58.797,168.147 L 58.797,134.548 L 0.546,134.548 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 6.112,144.818 L 17.458,144.818 L 17.458,149.099 L 6.112,149.099 L 6.112,144.818 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                            <Path Data="F1 M 12.642,153.594 L 23.988,153.594 L 23.988,157.876 L 12.642,157.876 L 12.642,153.594 Z" Fill="{StaticResource ColorEnteteAccueil}" />
                        </Canvas>
                    </Canvas>
                </Viewbox>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>
